namespace IAM.Interface.Model
{
    using IAM.Interface.Common;
    using IAM.Interface.Model.Interface;
    using System;
    using System.Reflection;
    using System.Text;

    public class ACItem : AbstractConvertObject, IConvertXml
    {
        private ACItems _acitems;
        private string _attr1;
        private string _attr2;
        private string _attr3;
        private string _attr4;
        private string _attr5;
        private string _attr6;
        private string _attr7;
        private string _attr8;
        private IAM.Interface.Model.DimensionLevel _dimensionlevel;
        private string _display;
        private string _id;
        private ACItem _parent;

        public ACItem()
        {
            this._id = "";
            this._display = "";
            this._dimensionlevel = null;
            this._parent = null;
            this._acitems = null;
            this._attr1 = "";
            this._attr2 = "";
            this._attr3 = "";
            this._attr4 = "";
            this._attr5 = "";
            this._attr6 = "";
            this._attr7 = "";
            this._attr8 = "";
        }

        public ACItem(ACItems acitems)
        {
            this._id = "";
            this._display = "";
            this._dimensionlevel = null;
            this._parent = null;
            this._acitems = null;
            this._attr1 = "";
            this._attr2 = "";
            this._attr3 = "";
            this._attr4 = "";
            this._attr5 = "";
            this._attr6 = "";
            this._attr7 = "";
            this._attr8 = "";
            this._acitems = acitems;
        }

        public override object ConvertToObject()
        {
            this.ID = EnDeCoding.Decode(this.CurrentXmlNode.Attributes["ID"].InnerText);
            this.Display = EnDeCoding.Decode(this.CurrentXmlNode.Attributes["Display"].InnerText);
            this.DimensionLevel = new IAM.Interface.Model.DimensionLevel();
            this.DimensionLevel.ID = EnDeCoding.Decode(this.CurrentXmlNode.Attributes["DimensionLevel"].InnerText);
            this.Parent = new ACItem();
            this.Parent.ID = EnDeCoding.Decode(this.CurrentXmlNode.Attributes["Parent"].InnerText);
            try
            {
                this.Attr1 = EnDeCoding.Decode(this.CurrentXmlNode.Attributes["Attr1"].InnerText);
                this.Attr2 = EnDeCoding.Decode(this.CurrentXmlNode.Attributes["Attr2"].InnerText);
                this.Attr3 = EnDeCoding.Decode(this.CurrentXmlNode.Attributes["Attr3"].InnerText);
                this.Attr4 = EnDeCoding.Decode(this.CurrentXmlNode.Attributes["Attr4"].InnerText);
                this.Attr5 = EnDeCoding.Decode(this.CurrentXmlNode.Attributes["Attr5"].InnerText);
                this.Attr6 = EnDeCoding.Decode(this.CurrentXmlNode.Attributes["Attr6"].InnerText);
                this.Attr7 = EnDeCoding.Decode(this.CurrentXmlNode.Attributes["Attr7"].InnerText);
                this.Attr8 = EnDeCoding.Decode(this.CurrentXmlNode.Attributes["Attr8"].InnerText);
            }
            catch
            {
            }
            return this;
        }

        public override bool Equals(object obj)
        {
            if ((this == null) && (obj == null))
            {
                return true;
            }
            ACItem aci = null;
            try
            {
                aci = (ACItem) obj;
            }
            catch
            {
                return false;
            }
            bool result = true;
            if (this.ID != aci.ID)
            {
                result = false;
            }
            else
            {
                if (this.Display != aci.Display)
                {
                    return false;
                }
                if (this.DimensionLevel.ID != aci.DimensionLevel.ID)
                {
                    return false;
                }
                if (this.Parent.ID != aci.Parent.ID)
                {
                    return false;
                }
                if (this.Attr1 != aci.Attr1)
                {
                    return false;
                }
                if (this.Attr2 != aci.Attr2)
                {
                    return false;
                }
                if (this.Attr3 != aci.Attr3)
                {
                    return false;
                }
                if (this.Attr4 != aci.Attr4)
                {
                    return false;
                }
                if (this.Attr5 != aci.Attr5)
                {
                    return false;
                }
                if (this.Attr6 != aci.Attr6)
                {
                    return false;
                }
                if (this.Attr7 != aci.Attr7)
                {
                    result = false;
                }
                else if (this.Attr8 != aci.Attr8)
                {
                    result = false;
                }
            }
            return result;
        }

        public override int GetHashCode()
        {
            int result = 1;
            PropertyInfo[] pi = base.GetType().GetProperties();
            foreach (PropertyInfo onofpi in pi)
            {
                result += onofpi.GetHashCode();
            }
            return result;
        }

        public string Attr1
        {
            get
            {
                return this._attr1;
            }
            set
            {
                this._attr1 = value;
            }
        }

        public string Attr2
        {
            get
            {
                return this._attr2;
            }
            set
            {
                this._attr2 = value;
            }
        }

        public string Attr3
        {
            get
            {
                return this._attr3;
            }
            set
            {
                this._attr3 = value;
            }
        }

        public string Attr4
        {
            get
            {
                return this._attr4;
            }
            set
            {
                this._attr4 = value;
            }
        }

        public string Attr5
        {
            get
            {
                return this._attr5;
            }
            set
            {
                this._attr5 = value;
            }
        }

        public string Attr6
        {
            get
            {
                return this._attr6;
            }
            set
            {
                this._attr6 = value;
            }
        }

        public string Attr7
        {
            get
            {
                return this._attr7;
            }
            set
            {
                this._attr7 = value;
            }
        }

        public string Attr8
        {
            get
            {
                return this._attr8;
            }
            set
            {
                this._attr8 = value;
            }
        }

        public IAM.Interface.Model.DimensionLevel DimensionLevel
        {
            get
            {
                return this._dimensionlevel;
            }
            set
            {
                this._dimensionlevel = value;
            }
        }

        public string Display
        {
            get
            {
                return this._display;
            }
            set
            {
                this._display = value;
            }
        }

        public string ID
        {
            get
            {
                return this._id;
            }
            set
            {
                this._id = value;
            }
        }

        public ACItems Items
        {
            get
            {
                return this._acitems;
            }
        }

        public ACItem Parent
        {
            get
            {
                return this._parent;
            }
            set
            {
                this._parent = value;
            }
        }

        public string XML
        {
            get
            {
                return (this.XMLBoday + this.XMLFinis);
            }
        }

        public string XMLBoday
        {
            get
            {
                StringBuilder _xml = new StringBuilder();
                _xml.Append("<ACItem");
                _xml.Append(" ID=\"" + EnDeCoding.Encode(this.ID) + "\"");
                _xml.Append(" Display=\"" + EnDeCoding.Encode(this.Display) + "\"");
                if (this.DimensionLevel != null)
                {
                    _xml.Append(" DimensionLevel=\"" + EnDeCoding.Encode(this.DimensionLevel.ID) + "\"");
                }
                else
                {
                    _xml.Append(" DimensionLevel=\"\"");
                }
                if (this.Parent != null)
                {
                    _xml.Append(" Parent=\"" + EnDeCoding.Encode(this.Parent.ID) + "\"");
                }
                else
                {
                    _xml.Append(" Parent=\"\"");
                }
                try
                {
                    _xml.Append(" Attr1=\"" + EnDeCoding.Encode(this.Attr1) + "\"");
                    _xml.Append(" Attr2=\"" + EnDeCoding.Encode(this.Attr2) + "\"");
                    _xml.Append(" Attr3=\"" + EnDeCoding.Encode(this.Attr3) + "\"");
                    _xml.Append(" Attr4=\"" + EnDeCoding.Encode(this.Attr4) + "\"");
                    _xml.Append(" Attr5=\"" + EnDeCoding.Encode(this.Attr5) + "\"");
                    _xml.Append(" Attr6=\"" + EnDeCoding.Encode(this.Attr6) + "\"");
                    _xml.Append(" Attr7=\"" + EnDeCoding.Encode(this.Attr7) + "\"");
                    _xml.Append(" Attr8=\"" + EnDeCoding.Encode(this.Attr8) + "\"");
                }
                catch
                {
                }
                _xml.Append(" />");
                return _xml.ToString();
            }
        }

        public string XMLFinis
        {
            get
            {
                return "";
            }
        }
    }
}
